@import '../../cell/style/component.scss';
@import '../../button/style/component.scss';
@import '../../icon/style/component.scss';

@include b(radio) {
  display: inline-block;
  position: relative;
  margin-left: r(10);

  &:first-child {
    margin-left: 0;
  }

  @include e(wrapper) {
    display: flex;
    align-items: center;
  }

  @include e(input) {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
  }

  @include e(text) {
    color: $color-text;
  }

  &__inner + &__text {
    margin-left: r(10);
  }

  @include e(inner) {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: r(20);
    height: r(20);
    border: 1px solid $theme-primary;
    border-radius: r(20);

    &:before {
      content: ' ';
      width: r(8);
      height: r(8);
      border-radius: r(8);
      background-color: $theme-primary;
      transform: scale(0);
      transition: all 0.2s cubic-bezier(0.71, -0.46, 0.88, 0.6);
    }
  }

  /* 选中状态 */
  @include m(checked) {
    @include e(inner) {
      &:before {
        transform: scale(1);
        transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
      }
    }
  }

  /* 禁用状态 */
  @include m(disabled) {
    @include e(inner) {
      border-color: $disabled-background;
      cursor: not-allowed;

      &:before {
        background-color: $disabled-background;
      }
    }

    @include e(text) {
      color: $disabled-color;
    }
  }

  /* 形状 */
  @include m(radius) {
    @include e(inner) {
      border-radius: $radius-md;
    }
  }

  @include m(round) {
    @include e(inner) {
      border-radius: r(20);
    }
  }

  @include m(rect) {
    @include e(inner) {
      border-radius: r(0);
    }
  }
}

/* 组合 */
@include b(radio-group) {
  @include m(block) {
    display: flex;
  }

  @include m(radius) {
    @include b(radio) {
      border-radius: $radius-md;
    }
  }

  @include m(round) {
    @include b(radio) {
      border-radius: r(15);
    }
  }

  @include m(rect) {
    @include e(inner) {
      border-radius: r(0);
    }
  }

  @include m(compact) {
    @include b(radio) {
      margin-left: -1px;

      &--radius {
        border-radius: 0;

        &:first-child {
          border-radius: $radius-md 0 0 $radius-md;
        }

        &:last-child {
          border-radius: 0 $radius-md $radius-md 0;
        }
      }

      &--round {
        border-radius: 0;

        &:first-child {
          border-radius: r(15) 0 0 r(15);
        }

        &:last-child {
          border-radius: 0 r(15) r(15) 0;
        }
      }
    }
  }
}
